<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人信息管理</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        :root {
            --primary-color: #5b6bf0;
            --primary-light: #7a87f5;
            --primary-dark: #4a55c4;
            --text-color: #333;
            --text-light: #666;
            --bg-color: #f5f7fa;
            --card-bg: #fff;
            --border-color: #e1e5eb;
            --error-color: #e74c3c;
            --success-color: #2ecc71;
            --warning-color: #f39c12;
            --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
            --radius: 10px;
        }
        
        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.6;
            padding: 20px;
            min-height: 100vh;
        }
        
        .container {
            max-width: 1000px;
            margin: 0 auto;
        }
        
        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--border-color);
        }
        
        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 24px;
            font-weight: 700;
            color: var(--primary-color);
        }
        
        .logo i {
            font-size: 28px;
        }
        
        .user-menu {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .nav-links {
            display: flex;
            gap: 20px;
        }
        
        .nav-links a {
            text-decoration: none;
            color: var(--text-light);
            font-weight: 500;
            transition: color 0.3s;
        }
        
        .nav-links a:hover, .nav-links a.active {
            color: var(--primary-color);
        }
        
        .profile-container {
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 25px;
        }
        
        @media (max-width: 768px) {
            .profile-container {
                grid-template-columns: 1fr;
            }
        }
        
        .sidebar {
            background-color: var(--card-bg);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 25px;
            height: fit-content;
        }
        
        .profile-card {
            text-align: center;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 20px;
        }
        
        .avatar-container {
            position: relative;
            width: 120px;
            height: 120px;
            margin: 0 auto 15px;
        }
        
        .avatar {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            object-fit: cover;
            border: 3px solid var(--primary-color);
        }
        
        .avatar-upload {
            position: absolute;
            bottom: 5px;
            right: 5px;
            width: 36px;
            height: 36px;
            background-color: var(--primary-color);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        .avatar-upload:hover {
            background-color: var(--primary-dark);
        }
        
        .profile-name {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 5px;
        }
        
        .profile-bio {
            color: var(--text-light);
            font-size: 14px;
            margin-bottom: 15px;
        }
        
        .profile-stats {
            display: flex;
            justify-content: space-around;
            margin-top: 15px;
        }
        
        .stat {
            text-align: center;
        }
        
        .stat-value {
            font-size: 18px;
            font-weight: 700;
            color: var(--primary-color);
        }
        
        .stat-label {
            font-size: 12px;
            color: var(--text-light);
        }
        
        .sidebar-menu {
            list-style: none;
        }
        
        .sidebar-menu li {
            margin-bottom: 10px;
        }
        
        .sidebar-menu a {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 15px;
            text-decoration: none;
            color: var(--text-color);
            border-radius: var(--radius);
            transition: all 0.3s;
        }
        
        .sidebar-menu a:hover, .sidebar-menu a.active {
            background-color: rgba(91, 107, 240, 0.1);
            color: var(--primary-color);
        }
        
        .sidebar-menu i {
            width: 20px;
            text-align: center;
        }
        
        .main-content {
            background-color: var(--card-bg);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 30px;
        }
        
        .section-title {
            font-size: 22px;
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .section-title i {
            color: var(--primary-color);
        }
        
        .form-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        
        @media (max-width: 576px) {
            .form-grid {
                grid-template-columns: 1fr;
            }
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            font-size: 14px;
        }
        
        .form-control {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid var(--border-color);
            border-radius: var(--radius);
            font-size: 15px;
            background-color: var(--card-bg);
            color: var(--text-color);
            transition: all 0.3s;
        }
        
        .form-control:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(91, 107, 240, 0.1);
        }
        
        textarea.form-control {
            min-height: 100px;
            resize: vertical;
        }
        
        .form-actions {
            display: flex;
            gap: 15px;
            margin-top: 30px;
        }
        
        .btn {
            padding: 12px 25px;
            border: none;
            border-radius: var(--radius);
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .btn-primary {
            background-color: var(--primary-color);
            color: white;
        }
        
        .btn-primary:hover {
            background-color: var(--primary-dark);
        }
        
        .btn-secondary {
            background-color: #f0f2f5;
            color: var(--text-color);
        }
        
        .btn-secondary:hover {
            background-color: #e4e6e9;
        }
        
        .social-links {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-top: 10px;
        }
        
        .social-link {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 15px;
            background-color: #f8f9fa;
            border-radius: 20px;
            text-decoration: none;
            color: var(--text-color);
            transition: all 0.3s;
        }
        
        .social-link:hover {
            background-color: #e9ecef;
            transform: translateY(-2px);
        }
        
        .social-link i {
            color: var(--primary-color);
        }
        
        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 15px 20px;
            border-radius: var(--radius);
            color: white;
            box-shadow: var(--shadow);
            transform: translateX(150%);
            transition: transform 0.3s ease;
            z-index: 1000;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .notification.show {
            transform: translateX(0);
        }
        
        .notification-success {
            background-color: var(--success-color);
        }
        
        .notification-error {
            background-color: var(--error-color);
        }
        
        .password-strength {
            height: 5px;
            background-color: #e1e5eb;
            border-radius: 5px;
            margin-top: 8px;
            overflow: hidden;
        }
        
        .password-strength-bar {
            height: 100%;
            width: 0;
            transition: width 0.3s, background-color 0.3s;
        }
        
        .password-weak {
            width: 33%;
            background-color: var(--error-color);
        }
        
        .password-medium {
            width: 66%;
            background-color: var(--warning-color);
        }
        
        .password-strong {
            width: 100%;
            background-color: var(--success-color);
        }
        
        .privacy-options {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        
        .privacy-option {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px;
            background-color: #f8f9fa;
            border-radius: var(--radius);
        }
        
        .privacy-option label {
            font-weight: 500;
        }
        
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 24px;
        }
        
        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        
        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 24px;
        }
        
        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
        
        input:checked + .toggle-slider {
            background-color: var(--primary-color);
        }
        
        input:checked + .toggle-slider:before {
            transform: translateX(26px);
        }
        
        footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            border-top: 1px solid var(--border-color);
            color: var(--text-light);
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <div class="logo">
                <i class="fas fa-blog"></i>
                <span>我的博客</span>
            </div>
            <div class="user-menu">
                <div class="nav-links">
                    <a href="#">首页</a>
                    <a href="#">文章</a>
                    <a href="#">作品</a>
                    <a href="#" class="active">个人中心</a>
                </div>
            </div>
        </header>
        
        <div class="profile-container">
            <aside class="sidebar">
                <div class="profile-card">
                    <div class="avatar-container">
                        <img src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&auto=format&fit=crop&w=200&h=200&q=80" alt="用户头像" class="avatar" id="user-avatar">
                        <div class="avatar-upload" id="avatar-upload-btn">
                            <i class="fas fa-camera"></i>
                        </div>
                    </div>
                    <h2 class="profile-name" id="profile-name">张明</h2>
                    <p class="profile-bio" id="profile-bio">前端开发者 & 技术博主</p>
                    <div class="profile-stats">
                        <div class="stat">
                            <div class="stat-value">42</div>
                            <div class="stat-label">文章</div>
                        </div>
                        <div class="stat">
                            <div class="stat-value">128</div>
                            <div class="stat-label">粉丝</div>
                        </div>
                        <div class="stat">
                            <div class="stat-value">56</div>
                            <div class="stat-label">关注</div>
                        </div>
                    </div>
                </div>
                
                <ul class="sidebar-menu">
                    <li><a href="#" class="active"><i class="fas fa-user"></i> 个人信息</a></li>
                    <li><a href="#"><i class="fas fa-lock"></i> 账户安全</a></li>
                    <li><a href="#"><i class="fas fa-bell"></i> 消息通知</a></li>
                    <li><a href="#"><i class="fas fa-shield-alt"></i> 隐私设置</a></li>
                    <li><a href="#"><i class="fas fa-palette"></i> 主题设置</a></li>
                    <li><a href="#"><i class="fas fa-cog"></i> 系统设置</a></li>
                </ul>
            </aside>
            
            <main class="main-content">
                <h2 class="section-title"><i class="fas fa-user-edit"></i> 编辑个人信息</h2>
                
                <form id="profile-form">
                    <div class="form-grid">
                        <div class="form-group">
                            <label for="full-name">姓名</label>
                            <input type="text" id="full-name" class="form-control" value="张明">
                        </div>
                        
                        <div class="form-group">
                            <label for="username">用户名</label>
                            <input type="text" id="username" class="form-control" value="zhangming">
                        </div>
                        
                        <div class="form-group">
                            <label for="email">电子邮箱</label>
                            <input type="email" id="email" class="form-control" value="zhangming@example.com">
                        </div>
                        
                        <div class="form-group">
                            <label for="phone">手机号码</label>
                            <input type="tel" id="phone" class="form-control" value="13800138000">
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="bio">个人简介</label>
                        <textarea id="bio" class="form-control">热爱前端技术，喜欢分享开发经验。专注于React、Vue和Node.js开发。</textarea>
                    </div>
                    
                    <div class="form-group">
                        <label for="location">所在地</label>
                        <input type="text" id="location" class="form-control" value="杭州">
                    </div>
                    
                    <div class="form-group">
                        <label>社交链接</label>
                        <div class="social-links">
                            <a href="#" class="social-link">
                                <i class="fab fa-github"></i>
                                <span>GitHub</span>
                            </a>
                            <a href="#" class="social-link">
                                <i class="fab fa-weibo"></i>
                                <span>微博</span>
                            </a>
                            <a href="#" class="social-link">
                                <i class="fab fa-zhihu"></i>
                                <span>知乎</span>
                            </a>
                            <a href="#" class="social-link">
                                <i class="fas fa-plus"></i>
                                <span>添加</span>
                            </a>
                        </div>
                    </div>
                    
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary">
                            <i class="fas fa-save"></i> 保存更改
                        </button>
                        <button type="button" class="btn btn-secondary" id="cancel-btn">
                            <i class="fas fa-times"></i> 取消
                        </button>
                    </div>
                </form>
                
                <h2 class="section-title" style="margin-top: 40px;"><i class="fas fa-lock"></i> 修改密码</h2>
                
                <form id="password-form">
                    <div class="form-grid">
                        <div class="form-group">
                            <label for="current-password">当前密码</label>
                            <input type="password" id="current-password" class="form-control">
                        </div>
                        
                        <div class="form-group">
                            <label for="new-password">新密码</label>
                            <input type="password" id="new-password" class="form-control">
                            <div class="password-strength">
                                <div class="password-strength-bar" id="password-strength-bar"></div>
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label for="confirm-password">确认新密码</label>
                            <input type="password" id="confirm-password" class="form-control">
                        </div>
                    </div>
                    
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary">
                            <i class="fas fa-key"></i> 更新密码
                        </button>
                    </div>
                </form>
                
                <h2 class="section-title" style="margin-top: 40px;"><i class="fas fa-shield-alt"></i> 隐私设置</h2>
                
                <div class="privacy-options">
                    <div class="privacy-option">
                        <label for="profile-visibility">公开个人资料</label>
                        <label class="toggle-switch">
                            <input type="checkbox" id="profile-visibility" checked>
                            <span class="toggle-slider"></span>
                        </label>
                    </div>
                    
                    <div class="privacy-option">
                        <label for="email-visibility">公开电子邮箱</label>
                        <label class="toggle-switch">
                            <input type="checkbox" id="email-visibility">
                            <span class="toggle-slider"></span>
                        </label>
                    </div>
                    
                    <div class="privacy-option">
                        <label for="search-visibility">允许搜索引擎索引</label>
                        <label class="toggle-switch">
                            <input type="checkbox" id="search-visibility" checked>
                            <span class="toggle-slider"></span>
                        </label>
                    </div>
                    
                    <div class="privacy-option">
                        <label for="message-permission">允许接收私信</label>
                        <label class="toggle-switch">
                            <input type="checkbox" id="message-permission" checked>
                            <span class="toggle-slider"></span>
                        </label>
                    </div>
                </div>
            </main>
        </div>
        
        <footer>
            <p>© 2025 7777博客平台 · 保留所有权利</p>
        </footer>
    </div>
    
    <div class="notification" id="notification">
        <i class="fas fa-check-circle"></i>
        <span id="notification-text">个人信息已更新！</span>
    </div>

    <script>
        // DOM元素
        const profileForm = document.getElementById('profile-form');
        const passwordForm = document.getElementById('password-form');
        const cancelBtn = document.getElementById('cancel-btn');
        const avatarUploadBtn = document.getElementById('avatar-upload-btn');
        const userAvatar = document.getElementById('user-avatar');
        const profileName = document.getElementById('profile-name');
        const profileBio = document.getElementById('profile-bio');
        const newPasswordInput = document.getElementById('new-password');
        const passwordStrengthBar = document.getElementById('password-strength-bar');
        const notification = document.getElementById('notification');
        const notificationText = document.getElementById('notification-text');
        
        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            // 表单提交事件
            profileForm.addEventListener('submit', handleProfileUpdate);
            passwordForm.addEventListener('submit', handlePasswordChange);
            
            // 取消按钮
            cancelBtn.addEventListener('click', resetForm);
            
            // 头像上传
            avatarUploadBtn.addEventListener('click', triggerAvatarUpload);
            
            // 密码强度检测
            newPasswordInput.addEventListener('input', checkPasswordStrength);
        });
        
        // 处理个人信息更新
        function handleProfileUpdate(e) {
            e.preventDefault();
            
            // 获取表单数据
            const formData = {
                name: document.getElementById('full-name').value,
                username: document.getElementById('username').value,
                email: document.getElementById('email').value,
                phone: document.getElementById('phone').value,
                bio: document.getElementById('bio').value,
                location: document.getElementById('location').value
            };
            
            // 更新侧边栏信息
            profileName.textContent = formData.name;
            profileBio.textContent = formData.bio;
            
            // 显示成功通知
            showNotification('个人信息已成功更新！', 'success');
            
            // 在实际应用中，这里会发送数据到服务器
            console.log('更新个人信息:', formData);
        }
        
        // 处理密码修改
        function handlePasswordChange(e) {
            e.preventDefault();
            
            const currentPassword = document.getElementById('current-password').value;
            const newPassword = document.getElementById('new-password').value;
            const confirmPassword = document.getElementById('confirm-password').value;
            
            // 简单验证
            if (!currentPassword) {
                showNotification('请输入当前密码', 'error');
                return;
            }
            
            if (newPassword.length < 6) {
                showNotification('新密码长度至少为6个字符', 'error');
                return;
            }
            
            if (newPassword !== confirmPassword) {
                showNotification('两次输入的密码不一致', 'error');
                return;
            }
            
            // 显示成功通知
            showNotification('密码已成功更新！', 'success');
            
            // 清空密码字段
            document.getElementById('current-password').value = '';
            document.getElementById('new-password').value = '';
            document.getElementById('confirm-password').value = '';
            passwordStrengthBar.className = 'password-strength-bar';
            
            // 在实际应用中，这里会发送数据到服务器
            console.log('更新密码:', {
                currentPassword,
                newPassword
            });
        }
        
        // 重置表单
        function resetForm() {
            profileForm.reset();
            showNotification('更改已取消', 'error');
        }
        
        // 触发头像上传
        function triggerAvatarUpload() {
            // 创建文件输入元素
            const fileInput = document.createElement('input');
            fileInput.type = 'file';
            fileInput.accept = 'image/*';
            
            fileInput.addEventListener('change', function(e) {
                const file = e.target.files[0];
                if (file) {
                    const reader = new FileReader();
                    
                    reader.onload = function(event) {
                        userAvatar.src = event.target.result;
                        showNotification('头像已成功更新！', 'success');
                    };
                    
                    reader.readAsDataURL(file);
                }
            });
            
            fileInput.click();
        }
        
        // 检查密码强度
        function checkPasswordStrength() {
            const password = newPasswordInput.value;
            let strength = 0;
            
            if (password.length >= 6) strength++;
            if (password.match(/[a-z]+/)) strength++;
            if (password.match(/[A-Z]+/)) strength++;
            if (password.match(/[0-9]+/)) strength++;
            if (password.match(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]+/)) strength++;
            
            // 更新密码强度条
            passwordStrengthBar.className = 'password-strength-bar';
            
            if (password.length === 0) {
                return;
            } else if (strength <= 2) {
                passwordStrengthBar.classList.add('password-weak');
            } else if (strength <= 4) {
                passwordStrengthBar.classList.add('password-medium');
            } else {
                passwordStrengthBar.classList.add('password-strong');
            }
        }
        
        // 显示通知
        function showNotification(message, type) {
            notificationText.textContent = message;
            notification.className = 'notification';
            notification.classList.add(`notification-${type}`, 'show');
            
            setTimeout(() => {
                notification.classList.remove('show');
            }, 3000);
        }
    </script>
</body>
</html>